# 请根据实际情况修改此处的SITE值和TC_ROOT路径
SITE = lib_template_itk
TC_ROOT = /usr/Siemens/Teamcenter13

DEBUG = -g
USER_INCLUDE = -I.
USER_LIB =

CC = gcc
LD = gcc

SRCS = $(wildcard *.cpp)
OBJS = $(patsubst %.cpp, %.o, $(SRCS))

DEFINES=-fvisibility=hidden -c -fPIC -m64 -DPOSIX -DIPLIB -DNO_DOT_H -DSITE=${SITE}
# -I指定头文件目录
INCLUDES = ${USER_INCLUDE} -I${TC_ROOT}/include -I${TC_ROOT}/include_cpp
# -L指定库文件目录，-l指定静态库名字(去掉文件名中的lib前缀和.a后缀)
LIBS = ${USER_LIB} -L${TC_ROOT}/lib -ltc

CFLAGS = ${DEFINES} ${INCLUDES} ${DEBUG} -c

TARGET = ${TC_ROOT}/lib/${SITE}.so

.PHONY:all clean

all: $(TARGET)
# 链接时候指定库文件目录及库文件名
$(TARGET): $(OBJS)
	$(LD) -shared -o $@ $^ $(LIBS)
 
# 编译时候指定头文件目录
%.o:%.cpp
	$(CC) $(CFLAGS) $^

clean:
	rm -f $(OBJS) $(TARGET)
